<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-2.2.3.min.js"></script>
</head>
<body>
微信支付<br/>
<img style="width: 300px; height: 300px;">
<script>
    $(function () {
        orderid = getQueryVariable("orderid");
        money = getQueryVariable("money");

        alert(orderid+"----"+money);

        var url = "wechatImg?orderid="+orderid+"&money="+money;
        $("img").attr("src",url);

        timer = setInterval(getPayStatus, 5000);

    });

    function getPayStatus(){
        $.ajax({
            type:"get",
            url:"/getPayStatus?orderid="+orderid,
            dataType:"json",
            success:function (data){
                if(data){
                    clearInterval(timer);
                    alert("支付成功");
                }
            }
        });
    }

    function getQueryVariable(variable) {
        var query = window.location.search.substring(1);
        var vars = query.split("&");
        for (var i=0;i<vars.length;i++) {
            var pair = vars[i].split("=");
            if(pair[0] == variable){return pair[1];}
        }
        return(false);
    }
</script>
</body>
</html>